Answer:

Applets are not stand-alone objects, and only run in the context of a larger program (such as a browser).

Running an JApplet

An applet does not have a main() method and so cannot be started as an application. For the applet to do anything, some other application must be running and call the applet's methods. A Web browser can do this.

A Web page is a text file that a Web browser can display. The browser follows instructions that are part of the text to nicely format the page. Here is a tiny Web page that asks for the applet AnotherHello:

<html>
<body>
<applet code="AnotherHello.class" width="300" height="150">
</applet>
</body>
</html>

This tells the browser to run the applet AnotherHello.class, and to use a 300 pixels wide and 150 high drawing area. Quote marks are required around all the values, including the numbers, but usually web browsers will work if you forget them.

You can create this Web page by typing the above characters into a text editor (or copy and paste them). Then save the file as AnotherHello.html in the same directory that has AnotherHello.class. Your directory should look something like this:

directory listing

Now double click on AnotherHello.html. Your default Web browser should start running and display the applet.

QUESTION 8:

Fill in the blanks in the following HTML file so that it asks to run the applet Poem in a window that is 250 pixels wide and 200 pixels high.

<html>
<body>
<applet code=""  width="" height="">
</applet>
</body>
</html>